a = input()
b = int(input())
if (a=="ABC" and b<2000) or (a=="ARC" and b<2800) or (a=="AGC" and b>=1200):
print('YES')
else:
print('NO')
#include<vector>
#include<string>
#include<math.h>
#include<bits/stdc++.h>
#define el '\n'
using ll=long long ;
//#define ll long long
#define all(x) (x).begin(),(x).end()
#define dl double
#include<algorithm>
#define print(x) cout << (x) << '\n'
/******************************************************
| rammah is typeing يواد |
|======================================================|
|نبدأ بقى سباكه بما يرضي الله|
|======================================================|
*******************************************************/
using namespace std;
const int N=10005;
ll freq[N];
ll pre[N];
ll gcd( ll a,ll b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
return (a / gcd(a, b)) * b;
}
ll zam[101];
struct point
{
int x;
int y;
};
bool cop(pair<string,int>a,pair<string,int>b)
{
if(a.second==b.second) return a.first<b.first;
else a.second<b.second;
}
bool isGoodArray(const vector<int>& a) {
int n = a.size();
int sum_a = 0;
for (int i = 0; i < n; i++) {
sum_a += a[i];
}
int sum_n = n * (n + 1) / 2;
if (sum_a != sum_n) {
return false;
}
return true;
}
bool check(int mid, vector<int>& v, vector<int>& a, int n, int k) {
int operations = 0;
for (int i = 0; i < n - 1; i++) {
operations += max(0, mid - a[i]);
if (operations > k) {
return false;
}
}
return true;
}
int fac(int num) {
int fact = 1;
for (int i = 2; i <= num; i++) {
fact *= i;
}
return fact;
}
int cal(int n, int m) {
int combinations = fac(n) / (fac(m) * fac(n - m));
return combinations;
}
vector<int> restoreArray(vector<int>& b, int n) {
sort(b.begin(), b.end());
vector<int> a(n);
int i = 0;
for (int j = 0; j < n; j++) {
a[j] = b[i];
i += (n - j);
if (i >= b.size()) {
break;
}
}
return a;
}
void FastCode() {std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
void they_call_me_007()
{
//freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout);
}
ll fac(ll n)
{
int ans=1;
for(int i=1;i<=n;i++) ans*=i;
return ans;
}
// قَالَ إِنَّمَا أَشْكُو بَثِّي وَحُزْنِي إِلَى اللَّهِ وَأَعْلَمُ مِنَ اللَّهِ مَا لا تَعْلَمُونَ
void work(/**/)
{
string str;cin>>str; int n;cin>>n;
if ((str=="ABC" and n<2000) or (str=="ARC" and n<2800) or (str=="AGC" and n>=1200)) cout<<"YES"<<el;else cout<<"NO"<<el;
}
signed main()
{
FastCode();
they_call_me_007();
int T;
T=1;
//cin>>T;
while(T--)
{
work();
}
}
979A - Pizza Pizza Pizza | 731A - Night at the Museum |
742A - Arpa’s hard exam and Mehrdad’s naive cheat | 1492A - Three swimmers |
1360E - Polygon | 1517D - Explorer Space |
1230B - Ania and Minimizing | 1201A - Important Exam |
676A - Nicholas and Permutation | 431A - Black Square |
474B - Worms | 987B - High School Become Human |
1223A - CME | 1658B - Marin and Anti-coprime Permutation |
14B - Young Photographer | 143A - Help Vasilisa the Wise 2 |
320A - Magic Numbers | 1658A - Marin and Photoshoot |
514A - Chewbaсca and Number | 382A - Ksenia and Pan Scales |
734B - Anton and Digits | 1080A - Petya and Origami |
1642D - Repetitions Decoding | 1440A - Buy the String |
1658F - Juju and Binary String | 478A - Initial Bet |
981A - Antipalindrome | 365A - Good Number |
1204B - Mislove Has Lost an Array | 1409D - Decrease the Sum of Digits |